package expr

import "go.mongodb.org/mongo-driver/bson"

const (
	Expr_id       = "_id"
	Expr_match    = "$match"
	Expr_or       = "$or"
	Expr_sum      = "$sum"
	Expr_group    = "$group"
	Expr_in       = "$in"
	Expr_add      = "$add"
	Expr_subtract = "$subtract"
	Expr_multiply = "$multiply"
	Expr_divide   = "$divide"
	Expr_unwind   = "$unwind"
	Expr_order    = "$sort"
	Expr_sort     = "$sort"
	Expr_first    = "$first"
	Expr_project  = "$project"
	Expr_push     = "$push"
)

func Last(field string) bson.D {
	return bson.D{{"$arrayElemAt", bson.A{field, -1}}}
}
func Sum(field string) bson.D {
	return bson.D{
		{Expr_sum, field},
	}
}
func First(field string) bson.D {
	return bson.D{
		{Expr_first, field},
	}
}
